#pragma once
#include <map>
#include <unordered_map>
#include "singleton.hpp"
#include <iostream>
#include <cinatra/use_asio.hpp>

#include <cinatra.hpp>

namespace bz
{
	class meet_room;



	class xd_client;

	class serv_manage
	{
	public:
		sigletonclass(serv_manage)
	public:


		void init(const std::string &mcu_ip);
		void add_meet_room(int& id);
		xd_client* add_mcu(const std::string &ip,const std::string &user,const std::string &pwd);

		meet_room* get_room(int&);
		async_simple::coro::Lazy<void> del_room(int id);

		std::map<int, meet_room*> meet_room_map_;
		std::unordered_map<std::string, xd_client*> mcu_map_;

		xd_client* main_mcu_;




		

		void room_device_update();
	private:
		serv_manage();
		~serv_manage();

		void load_all_fme();

		asio::io_context  client_io_;
		asio::io_context  server_io_;

		std::string edition_;


		std::string main_ip_;








		friend class sys_controller;
		friend class container;
	};


}